<script setup>
import PublishHead from './components/PublishHead.vue'
import { userInfoStore } from '@/stores/user'
import { onMounted, ref } from 'vue'

const theUserInfoStore = userInfoStore()
const isData = ref(true)

onMounted(() => {
  theUserInfoStore.getTheUserInfo()
})
</script>

<template>
  <div class="common-layout">
    <div class="head">
      <PublishHead />
    </div>
    <div class="common-main">
      <div class="aside-main">
        <div class="submit-note">
          <RouterLink to="/creator">
            <div class="submit-note-btn">发布笔记</div>
          </RouterLink>
        </div>
        <div class="aside-options">
          <router-link to="/creator/home" exact active-class="active-link">
            <div class="option-item">
              <span>首页</span>
            </div>
          </router-link>
          <router-link to="/creator/notemanager" exact active-class="active-link">
            <div class="option-item">
              <span>笔记管理</span>
            </div>
          </router-link>
          <router-link>
            <div class="option-item" @click="isData = !isData">
              <span>数据看板</span>
            </div>
          </router-link>
          <router-link>
            <div class="option-item-child" v-if="isData">
              <span>账号概览</span>
            </div>
          </router-link>
          <router-link>
            <div class="option-item-child" v-if="isData">
              <span>内容分析</span>
            </div>
          </router-link>
          <router-link>
            <div class="option-item-child" v-if="isData">
              <span>粉丝数据</span>
            </div>
          </router-link>
          <router-link>
            <div class="option-item">
              <span>笔记灵感</span>
            </div>
          </router-link>
        </div>
      </div>
      <div class="view-main">
        <RouterView />
      </div>
    </div>
  </div>
</template>

<style scoped lang="scss">
.common-layout {
  background: #eef1f8;
  min-height: 100vh;
  .head {
    position: fixed;
    z-index: 1;
  }
  .common-main {
    display: flex;
    .aside-main {
      background: rgba(255, 255, 255, 1);
      min-height: 100vh;
      position: fixed;
      .aside-options {
        margin-top: 20px;
        margin-left: 10px;
        margin-right: 10px;
        a {
          text-decoration: none;
          color: black;
          .option-item {
            cursor: pointer;
            padding-top: 10px;
            padding-bottom: 10px;
            border-radius: 7px;
            span {
              padding-left: 40px;
              font-size: 14px;
            }
          }
          .option-item-child:hover {
            color: #3a64ff;
          }
          .option-item:hover {
            color: #3a64ff;
          }
        }
        a {
          text-decoration: none;
          color: black;
          .option-item-child {
            cursor: pointer;
            padding-top: 10px;
            padding-bottom: 10px;
            border-radius: 7px;
            span {
              padding-left: 50px;
              font-size: 14px;
            }
          }
        }
        .active-link {
          color: #3a64ff;
          .option-item {
            background: #f2f7ff;
            cursor: pointer;
          }
        }
      }
    }
  }
  .view-main {
    padding-left: 200px;
    padding-top: 70px;
    width: 100%;
  }
}
.head {
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
  min-width: 100%;
  position: relative;
}
.submit-note {
  display: flex;
  justify-content: center;
  align-items: center;
  border-bottom: 2px solid #f7f7f7;
  padding-bottom: 20px;
  padding-top: 90px;
  padding-left: 10px;
  padding-right: 10px;
  a {
    text-decoration: none;
    .submit-note-btn {
      background: #ff2442;
      min-width: 180px;
      min-height: 40px;
      border-radius: 5px;
      display: flex;
      justify-content: center;
      align-items: center;
      cursor: pointer;
      color: white;
    }
  }
}
</style>
